package com.customer.crm.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Lyp
 * @create 2021/12/15
 */

@Configuration
public class MyConfig implements WebMvcConfigurer {


    //配置根目录跳转页面
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("login");
        registry.addViewController("/login").setViewName("login");
        registry.addViewController("/login.html").setViewName("login");
    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginHandlerInterceptor()).
                addPathPatterns("/**").
                excludePathPatterns("/login.html", "/", "/login", "/index", "/bootstrap-3.3.7-dist/**",
                        "/js/**", "/images/**", "/css/**", "/easyui/**", "/jquery/**","/easyui/**",
                        "/kindeditor/**", "/ztree/**");
    }
}
